import 'package:get/get.dart';

import '../utils/lf_logger.dart';

int parseInt(String? key, {int defaultKey = 0}) {
  if (key == null || key.isEmpty || key.isNum == false) {
    return defaultKey;
  }
  var intKey = defaultKey;
  try {
    intKey = int.tryParse(key) ?? double.tryParse(key)?.toInt() ?? defaultKey;
  } catch (e) {
    lfLogger.e(e);
  }
  return intKey;
}
